Skip to content

fix:[mono] optimize commit_info related apis#1107

Merged
genedna merged 2 commits into
gitmono-dev:mainfrom
benjamin-747:main
Jun 10, 2025
Merged

fix:[mono] optimize commit_info related apis#1107
genedna merged 2 commits into
gitmono-dev:mainfrom
benjamin-747:main

Conversation

@benjamin-747

Copy link
Copy Markdown
Collaborator

No description provided.

This comment was marked as outdated.

@vercel

vercel Bot commented Jun 10, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
mega ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 10, 2025 8:57am

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds optimized commit-info APIs by introducing new “content-hash” and “dir-hash” endpoints, refactors the Ceres API handler to centralize commit-to-tree mapping, updates the HTTP server’s CORS handling, and improves batch inserts with conflict resolution.

  • Define CommonResultVecTreeHashItem, new client types, and two GET endpoints (/tree/content-hash, /tree/dir-hash) in the TypeScript client
  • Switch server CORS to dynamic origin and tighten headers/methods
  • Refactor Ceres ApiHandler to use a single item_to_commit_map and new TreeHashItem, remove duplication
  • Enhance batch-save in Jupiter storage to ignore specific DB errors

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
moon/packages/types/generated.ts Added types and client methods for content-hash and dir-hash APIs
mono/src/server/https_server.rs Use dynamic CORS origin header and allow all methods
mono/src/api/api_router.rs Updated router to return TreeHashItem instead of commit items
jupiter/src/storage/mod.rs Documented batch-save-with-conflict function for SeaORM
config/config.toml Updated ui_domain default and example comment
ceres/src/model/git.rs Introduced TreeHashItem and renamed commit fields
ceres/src/api_service/mono_api_service.rs Centralized commit mapping into item_to_commit_map
ceres/src/api_service/import_api_service.rs Aligned import service with new mapping logic
Comments suppressed due to low confidence (5)

mono/src/api/api_router.rs:188

  • The handler for /tree/content-hash is using CodePreviewQuery instead of the newly generated GetApiTreeContentHashParams. Update the signature to Query<GetApiTreeContentHashParams> to bind the correct parameters.
Query(query): Query<CodePreviewQuery>,

mono/src/api/api_router.rs:213

  • Similarly, the handler for /tree/dir-hash should use GetApiTreeDirHashParams instead of CodePreviewQuery to match the defined query type.
Query(query): Query<CodePreviewQuery>,

jupiter/src/storage/mod.rs:84

  • This comment references sqlx, but the implementation uses sea_orm. Update the comment to accurately reflect SeaORM’s behavior or remove the outdated reference.
// notice that sqlx not support packets larger than 16MB now

config/config.toml:112

  • [nitpick] The example domain in this comment (app.gitmega.com) does not match the updated default ui_domain (local.gitmega.com). Consider aligning the example with the actual default value.
# Used for redirect to ui after login, for example: http://app.gitmega.com

ceres/src/api_service/import_api_service.rs:133

  • GitObjectCache is used here but not imported. Add use crate::api_service::GitObjectCache; (or the correct module path) to the top of the file.
let mut cache = GitObjectCache::default();

@genedna
genedna enabled auto-merge June 10, 2025 10:17
@genedna
genedna added this pull request to the merge queue Jun 10, 2025
Merged via the queue into gitmono-dev:main with commit b4c26ca Jun 10, 2025
21 of 22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants